package com.iweb.day04;

/**
 * @author WuYongheng
 * @date 2021/10/26
 * @description
 */
public class SortUtil {
    public void bubbleSort(){
        int t=0;
        int [] array = {42,65,15,78,30};
        for (int j = 0; j < array.length-1; j++) {
            for (int i = 0; i < array.length-1-j; i++) {
                if (array[i] < array[i + 1]) {//从小到大，或从大到小
                    t = array[i];
                    array[i] = array[i + 1];
                    array[i + 1] = t;
                }
            }
        }
    }
}
